using Assets.Scripts.GDK;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;

namespace Brick
{
	public class SkillThreeGuide : BaseGuideLayer
	{
		public RectTransform arrow;

		public RectTransform ListBox;

		public RectTransform ListBoxBg;

		public override void OnStart()
		{
			bindItemTouch();
			view.gameObject.SetActive(value: false);
			ListBoxBg.gameObject.SetActive(value: false);
			gdk_runTime.setTimeOut(delegate
			{
				view.gameObject.SetActive(value: true);
				showBtns();
			}, 1f);
		}

		private void showBtns()
		{
			Vector3 localPosition = arrow.localPosition;
			arrowMove(arrow, localPosition - new Vector3(-50f, 0f, 0f), localPosition);
		}

		private void bindItemTouch()
		{
			GameObject gameObject = gdk_game_manager.loadPrefab(GuideID.ALERT);
			gameObject.GetComponent<GuideAlert>().OnData(8);
			gameObject.transform.SetParent(box);
		}

		private void bindItemTouch2()
		{
			GameObject gameObject = gdk_game_manager.loadPrefab(GuideID.ALERT);
			gameObject.GetComponent<GuideAlert>().OnData(9);
			gameObject.transform.SetParent(box);
		}

		public void OnTipThreeBtnClick()
		{
			ListBoxBg.gameObject.SetActive(value: true);
			gdk_game_manager.PlaySound(AudioID.click);
			OnTipThreeBtnAction();
		}

		private void OnTipThreeBtnAction()
		{
			gdk_utils.removeAllChildren(box);
			gdk_utils.removeAllChildren(view);
			bindItemTouch2();
			instantiateDisplayBox();
		}

		private void showSelectCanvas(char[] selectArr)
		{
			gdk_utils.removeAllChildren(ListBox);
			double num = 360 / selectArr.Length;
			int num2 = 0;
			for (int i = 0; i < selectArr.Length; i++)
			{
				string str = selectArr[i].ToString();
				double[] array = Utils.hypotenuse(148.0, num * (double)num2);
				num2++;
				GameObject gameObject = gdk_game_manager.loadPrefab(ItemID.TipSkillSelectItemPrefab);
				Transform transform = gdk_utils.FindChild(gameObject.transform, "textStr");
				transform.GetComponent<Text>().text = str;
				gameObject.SetActive(value: true);
				float num3 = 6f / (float)selectArr.Length;
				if ((double)num3 > 1.2)
				{
					num3 = 1.2f;
				}
				gameObject.transform.localScale = new Vector3(num3, num3, 1f);
				gameObject.transform.position = new Vector3((float)array[0], (float)array[1], -100f);
				gameObject.transform.SetParent(ListBox, worldPositionStays: false);
				RectTransform rectTransform = gdk_utils.NewButton(gameObject);
				Button component = rectTransform.gameObject.GetComponent<Button>();
				component.onClick.AddListener(delegate
				{
					onClick(str);
				});
				PlayItemTween(gameObject);
			}
		}

		private void instantiateDisplayBox()
		{
		}

		private void onClick(string str)
		{
			UnityEngine.Object.Destroy(base.gameObject, 0f);
			gdk_game_manager.PlaySound(AudioID.skill_choose);
		}

		private void PlayItemTween(GameObject item)
		{
			item.transform.DOShakeRotation(1f, new Vector2(10f, 10f), 10, 180f).SetLoops(1, LoopType.Incremental);
			item.transform.DOShakePosition(1f, new Vector2(10f, 10f), 10, -180f).SetLoops(1, LoopType.Incremental);
		}
	}
}

